package com.salt.modules.log.config;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description
 * @Author salt
 * @Date 2023/4/19
 * @Version 1.0.1
 */
@Configuration
public class SnowflakeConfig {

    private long workId = 1;  // 工作机器（终端）ID
    private long datacenterId = 1;  // 数据中心ID

    @Bean
    public Snowflake snowflake() {
        return IdUtil.createSnowflake(workId, datacenterId);
    }
}
